package com.flashcash.solu.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.KeyEvent;
import android.view.WindowManager;

import com.flashcash.solu.R;


public class MyProgressBar extends Dialog {

    public MyProgressBar(Context context) {
        super(context, R.style.CustomDialog);
        initView();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_BACK:
                if (MyProgressBar.this.isShowing())
                    MyProgressBar.this.dismiss();
                break;
        }
        return true;
    }

    private void initView() {
        setContentView(R.layout.progress_dialog_layout);
        setCanceledOnTouchOutside(true);
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        attributes.alpha = 0.8f;
        getWindow().setAttributes(attributes);
        setCancelable(false);
    }

}
